package com.auxgroup.hr.front.commons.exception;

import com.auxgroup.hr.front.commons.BaseRetCode;
import com.auxgroup.hr.front.commons.enums.CoreRetCode;

/**
 * @author ye.meng@ssitsh.com
 *
 * @since 1.0.0 create date 2017年10月16日
 */
public class CoreException extends RuntimeException {

	private static final long serialVersionUID = 1L;

	private String retCode;
	private String retMsg;
	private String extInfo;


	/**
	 * 
	 */
	public CoreException() {
		super();
	}
	
	public CoreException(String retCode, String retMsg) {
		this();
		this.retCode = retCode;
		this.retMsg = retMsg;
	}
	/**
	 * @param retCode
	 * @param retMsg
	 * @param extInfo
	 */
	public CoreException(String retCode, String retMsg, String extInfo) {
		super();
		this.retCode = retCode;
		this.retMsg = retMsg;
		this.extInfo = extInfo;
	}

	/**
	 * @param message
	 * @param cause
	 * @param enableSuppression
	 * @param writableStackTrace
	 */
	public CoreException(String retCode, String retMsg, Throwable cause) {
		super(cause);
		this.retCode = retCode;
		this.retMsg = retMsg;
	}

	public CoreException(String retCode, String retMsg, String extInfo,
			Throwable cause) {
		this(retCode, retMsg, cause);
		this.extInfo = extInfo;
	}

	public CoreException(CoreRetCode retCode, Throwable cause) {
		super(cause);
		if (retCode != null) {
			this.retCode = retCode.getRetCode();
			this.retMsg = retCode.getRetMsg();
		}
	}
	public CoreException(CoreRetCode retCode) {
		if (retCode != null) {
			this.retCode = retCode.getRetCode();
			this.retMsg = retCode.getRetMsg();
		}
	}
	public CoreException(CoreRetCode retCode,String extInfo) {
		if (retCode != null) {
			this.retCode = retCode.getRetCode();
			this.retMsg = retCode.getRetMsg();
		}
		this.extInfo=extInfo;
	}
	public CoreException(BaseRetCode retCode) {
		if (retCode != null) {
			this.retCode = retCode.getRetCode();
			this.retMsg = retCode.getRetMsg();
		}
	}
	public CoreException(BaseRetCode retCode,String extInfo) {
		if (retCode != null) {
			this.retCode = retCode.getRetCode();
			this.retMsg = retCode.getRetMsg();
		}
		this.extInfo=extInfo;
	}
	public CoreException(BaseRetCode retCode, String extInfo, Throwable cause) {
		this(retCode, cause);
		this.extInfo = extInfo;
	}
	public CoreException(BaseRetCode retCode, Throwable cause) {
		super(cause);
		if (retCode != null) {
			this.retCode = retCode.getRetCode();
			this.retMsg = retCode.getRetMsg();
		}
	}

	public CoreException(CoreRetCode retCode, String extInfo, Throwable cause) {
		this(retCode, cause);
		this.extInfo = extInfo;
	}

	public String getRetCode() {
		return retCode;
	}

	public String getRetMsg() {
		return retMsg;
	}

	public String getExtInfo() {
		return extInfo;
	}

}
